import {BrowserModule} from '@angular/platform-browser';
import {NgModule} from '@angular/core';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {HttpModule} from '@angular/http';

import {AppComponent} from './app.component';
import {HeaderComponent} from './header/header.component';
import {MenuComponent} from './menu/menu.component';
import {SidebarComponent} from './sidebar/sidebar.component';
import {FooterComponent} from './footer/footer.component';
import {ContentComponent} from './content/content.component';
import {StockManageComponent} from './stock/stock-manage/stock-manage.component';
import {StarsComponent} from './stars/stars.component';
import {RouterModule, Routes} from "@angular/router";
import {DashboardComponent} from './dashboard/dashboard.component';
import {StockFormComponent} from './stock/stock-form/stock-form.component';
import {NewsComponent} from './news/news.component';
import {AdvertComponent} from './advert/advert.component';
import {MessageComponent} from './message/message.component';
import {StockService} from "./stock/stock.service";
import { StockFilterPipe } from './stock/stock-filter.pipe';

const routeConfig: Routes = [
    {path: '', redirectTo: '/dashboard', pathMatch: 'full'},
    {path: 'dashboard', component: DashboardComponent},
    {path: 'stock', component: StockManageComponent},
    {path: 'stock/:id', component: StockFormComponent},
    {path: 'news', component: NewsComponent},
    {path: 'advert', component: AdvertComponent},
    {path: 'message', component: MessageComponent}
]

@NgModule({
    declarations: [
        AppComponent,
        HeaderComponent,
        MenuComponent,
        SidebarComponent,
        FooterComponent,
        ContentComponent,
        StockManageComponent,
        StarsComponent,
        DashboardComponent,
        StockFormComponent,
        NewsComponent,
        AdvertComponent,
        MessageComponent,
        StockFilterPipe
    ],
    imports: [
        BrowserModule,
        FormsModule,
        HttpModule,
        ReactiveFormsModule,
        RouterModule.forRoot(routeConfig)
    ],
    providers: [StockService],
    bootstrap: [AppComponent]
})
export class AppModule {
}
